namespace _151 {

var reverseWords = function(str: string): string {
    return str.split(' ').reverse().filter(x => x.length > 0).join(' ')
};

console.assert( reverseWords("the sky is blue") === "blue is sky the")

}